package org.looop.studio.bean.config.scope;

import java.util.Map;

import org.looop.studio.bean.config.BeanFactoryConfig;
import org.looop.studio.bean.factory.BeanFactory;
import org.looop.studio.bean.scope.BeanScope;

public class BeanScopeConfig implements BeanFactoryConfig{
	private BeanFactory beanFactory;
	private Map<String, BeanScope> scopeMap;
	
	public Map<String, BeanScope> getScopeMap() {
		return scopeMap;
	}

	public void setScopeMap(Map<String, BeanScope> scopeMap) {
		this.scopeMap = scopeMap;
	}

	@Override
	public void initBean() {
		for(Map.Entry<String, BeanScope> scopeEntry : scopeMap.entrySet()){
			beanFactory.registerBeanScope(scopeEntry.getKey(), scopeEntry.getValue());
		}
	}

	@Override
	public void setBeanFactory(BeanFactory beanFactory) {
		this.beanFactory = beanFactory;
	}
	
}
